package com.niiwoo.civet.user.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Optional;

/**
 * @Description:
 * @Author:LiJian
 * @Date:2017/11/21
 */
@Getter
@AllArgsConstructor
public enum LinkManRelationEnum {

    SPOUSE((byte) 1, "配偶"),
    FATHER((byte) 2, "父亲"),
    MOTHER((byte) 3, "母亲"),
    BROTHER((byte) 4, "兄弟"),
    SISTERS((byte) 5, "姐妹"),
    CHILDREN((byte) 6, "子女"),
    OTHER((byte) 7, "其他"),
    WORKMATE((byte) 8, "同事"),
    FRIEND((byte) 9, "朋友");

    private Byte relation;
    private String desc;

    public static LinkManRelationEnum getByEventType(byte relation) {
        Optional<LinkManRelationEnum> linkManRelationEnum =
                Arrays.stream(values()).filter(value -> value.getRelation().byteValue() == relation).findFirst();
        return linkManRelationEnum.isPresent() ? linkManRelationEnum.get() : null;
    }

    @Getter
    @AllArgsConstructor
    public enum LinkManOrderNoEnum{
        LINKMAN_1((byte) 1, "联系人1"),
        LINKMAN_2((byte) 2, "联系人2");

        private int type;
        private String desc;
    }

}
